package manager

import (
	"pq/repository"
)

type ResourceSubjectManager struct{

}

//把已有的题目关联到资料题
//func (rsm *ResourceSubjectManager) ImportSubject(resource_id int,subjectDto dto.SubjectDto)(int64,error){
//	resourceDomain := domain.ResourceDomain{}
//	resourceDomain.AddSubject(subjectDto)
//	subjectEntity := models.PqCsTestItem{Id:subjectDto.Get("id").(int)}
//	orm.NewOrm().Read(&subjectEntity)
//	subjectEntity.PqCsTestResourceId = resource_id
//	return orm.NewOrm().Update(&subjectEntity)
//}

func (rsm *ResourceSubjectManager) ImportSubjectByNum(lib_id int ,resource_id int,num int) (int64,error){
	resourceRepository := repository.ResourceRepository{}
	return resourceRepository.ImportSubject(resource_id,resourceRepository.GetLibSubjectByNumber(lib_id,num))
}

func (rsm *ResourceSubjectManager) Delete(resource_id int)(int64,error){
	resourceRepository := repository.ResourceRepository{}
	return resourceRepository.Delete(resource_id)
}
